package com.ycz.cglib;

import org.springframework.cglib.proxy.MethodInterceptor;
import org.springframework.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

/**
 * @author ycz
 * @date 2021/7/3
 * 目标代理类1 拦截器
 */
public class ObjProxyClassInterceptor implements MethodInterceptor {

    public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {
        System.out.println("ObjProxyClassInterceptor before()=="+method.getName());
        Object invokeSuper = methodProxy.invokeSuper(o, objects);
        System.out.println("ObjProxyClassInterceptor after()=="+method.getName());
        return invokeSuper;
    }

}
